package cn.kailangtu.dataspot.db;

import java.util.Calendar;

public class NewTotalDataEntity extends BaseEntity{
    private int year;
    private int month;
    private int day;
    private int hour;
    private int minuter;
    private int second;
    private int electricA;
    private int electricB;
    private int electricC;
    private int voltageA;
    private int voltageB;
    private int voltageC;


    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }

    public int getHour() {
        return hour;
    }

    public void setHour(int hour) {
        this.hour = hour;
    }

    public int getMinuter() {
        return minuter;
    }

    public void setMinuter(int minuter) {
        this.minuter = minuter;
    }

    public int getSecond() {
        return second;
    }

    public void setSecond(int second) {
        this.second = second;
    }

    public int getElectricA() {
        return electricA;
    }

    public void setElectricA(int electricA) {
        this.electricA = electricA;
    }

    public int getElectricB() {
        return electricB;
    }

    public void setElectricB(int electricB) {
        this.electricB = electricB;
    }

    public int getElectricC() {
        return electricC;
    }

    public void setElectricC(int electricC) {
        this.electricC = electricC;
    }

    public int getVoltageA() {
        return voltageA;
    }

    public void setVoltageA(int voltageA) {
        this.voltageA = voltageA;
    }

    public int getVoltageB() {
        return voltageB;
    }

    public void setVoltageB(int voltageB) {
        this.voltageB = voltageB;
    }

    public int getVoltageC() {
        return voltageC;
    }

    public void setVoltageC(int voltageC) {
        this.voltageC = voltageC;
    }

    public static NewTotalDataEntity build(int electricA,int electricB,int electricC,int voltageA,int voltageB,int voltageC)
    {
        Calendar calendar = Calendar.getInstance();
        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH) + 1; // 0-based
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        int hour = calendar.get(Calendar.HOUR_OF_DAY); // 24-hour format
        int minute = calendar.get(Calendar.MINUTE);
        int second = calendar.get(Calendar.SECOND);

        NewTotalDataEntity entity = new NewTotalDataEntity();
        entity.setDay(day);
        entity.setYear(year);
        entity.setMonth(month);
        entity.setHour(hour);
        entity.setMinuter(minute);
        entity.setSecond(second);
        entity.setElectricA(electricA);
        entity.setElectricB(electricB);
        entity.setElectricC(electricC);
        entity.setVoltageA(voltageA);
        entity.setVoltageB(voltageB);
        entity.setVoltageC(voltageC);

        return entity;
    }

    public static NewTotalDataEntity build(int electricA,int electricB,int electricC,int voltageA,int voltageB,int voltageC,long data)
    {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(data);
        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH) + 1; // 0-based
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        int hour = calendar.get(Calendar.HOUR_OF_DAY); // 24-hour format
        int minute = calendar.get(Calendar.MINUTE);
        int second = calendar.get(Calendar.SECOND);

        NewTotalDataEntity entity = new NewTotalDataEntity();
        entity.setCreateTime(data);
        entity.setDay(day);
        entity.setYear(year);
        entity.setMonth(month);
        entity.setHour(hour);
        entity.setMinuter(minute);
        entity.setSecond(second);
        entity.setElectricA(electricA);
        entity.setElectricB(electricB);
        entity.setElectricC(electricC);
        entity.setVoltageA(voltageA);
        entity.setVoltageB(voltageB);
        entity.setVoltageC(voltageC);

        return entity;
    }
}
